Hệ thống quản lý trường học bằng PHP / MySQLi
1
2 <?php
3 //error_reporting(0);
4 include('connect.php');
5 if (isset($_POST['register'])){
6
7 $admission_number=$_POST['admission_number'];
8 $sirname = $_POST['sirname'];
9 $firstname= $_POST['firstname'];
10 $lastname = $_POST['lastname'];
11 $idno = $_POST['idno'];
12 $dateofbirth = $_POST['dateofbirth'];
13 $gender = $_POST['gender'];
14 // $country_id = $_POST['country_id'];
15 // $county_id = $_POST['county_id'];
16 // $constituency_id = $_POST['constituency_id'];
17 $mobile = $_POST['mobile'];
18 $email = $_POST['email'];
19 $address = $_POST['address'];
20 $zipcode = $_POST['zipcode'];
21 $course_id = $_POST['course_id'];
22 $border = $_POST['border'];
23 $reg_date = $_POST['reg_date'];
24 //dri nah mah edit xng data
25 $psirname = $_POST['psirname'];
26 $pfirstname= $_POST['pfirstname'];
27 $plastname = $_POST['plastname'];
28 $pmobile= $_POST['pmobile'];
29 $prelationship = $_POST['prelationship'];
30 $feepayable = $_POST['feepayable'];
31
32 // $sql2="UPDATE `studentstable` SET `sirname`='$sirname',`firstname`='$firstname',`lastname`='$lastname',`idno`='$idno',`dateofbirth`='$dateofbirth',`gender`='$gender',`country_id`='$country_id',`county_id`='$county_id',`constituency_id`='$constituency_id',`mobile`='$mobile',`email`='$email',`address`='$address',`zipcode`='$zipcode',
33 // `course_id`='$course_id',`border`='$border',`reg_date`='$reg_date',`feepayable`='$feepayable'
34 // WHERE `admission_number`='$admission_number'";
35
36 $sql2="UPDATE `studentstable` SET `sirname`='$sirname',`firstname`='$firstname',`lastname`='$lastname',`idno`='$idno',`dateofbirth`='$dateofbirth',`gender`='$gender',`mobile`='$mobile',`email`='$email',`address`='$address',`zipcode`='$zipcode',
37 `course_id`='$course_id',`border`='$border',`reg_date`='$reg_date',`feepayable`='$feepayable'
38 WHERE `admission_number`='$admission_number'";
39
40 $sql3="UPDATE parents SET psirname ='$psirname', pfirstname ='$pfirstname',
41 plastname ='$plastname',pmobile ='$pmobile', prelationship = '$prelationship'
42 WHERE admission_number = '$admission_number'";
43
44 mysqli_query($db,$sql2);
45 mysqli_query($db,$sql3);
46
47 ?>
48 <?php
49
50 $query="SELECT * FROM studentstable WHERE course_id='$course_id'";
51 $records2=mysqli_query($db,$query);
52 while($rec=mysqli_fetch_array($records2))
53 {
54 $id = $rec['course_id'];
55 }?>
56
57 <script>
58 alert('Record Succsessfully Updated');
59 window.location = "viewstudents.php?id=<?php echo $id;?>";
60 </script>
61
62 <?php
63
64 }?>